﻿/* Created on 2017.1.29
 *
 * @author: jia
 */

#pragma once
#include "xdef.h"

typedef void (*_DebugCallback)(int level, const char *str);

extern "C" {
    _EXPORT_API const char* _Native_GetCurrentPath();
    _EXPORT_API void _Native_ReleaseMemory(void **pBuffer);
    _EXPORT_API void _Python_RegisterModule();
    _EXPORT_API void _Python_Start(const char* program, const char* home);
    _EXPORT_API bool _Python_CheckInterpreter(const char *program);
    _EXPORT_API bool _Python_Finalize();
    _EXPORT_API int _Python_InitScript(const char* pythonfile);
    _EXPORT_API int _Python_InitSharpCall(_csharp_callback cb);
    _EXPORT_API int _Python_RunString(const char* script);
    _EXPORT_API const char *_Python_GetFunction(const char *module, const char *funcname, int *id);
    _EXPORT_API int _Python_CreateClassInstance(const char *module, const char *classname, int *id, int argc, _var *argv, int strc, const char **strs, const char **err);
    _EXPORT_API int _Python_CallFunction(int argc, _var *argv, int strc, const char **strs, const char **err);
    _EXPORT_API int _Python_CallInstanceMethod(const char *method, int argc, _var *argv, int strc, const char **strs, const char **err);
	_EXPORT_API int _Python_GetInstanceMethod(const char *method, _var *argv, const char **err);
    _EXPORT_API int _Python_SharpCollectGarbage(int n, int *result);
    _EXPORT_API int _Python_RunFunction(const char* pythonfile, const char* funcname, const char* args);
    _EXPORT_API void _RegisterDebugCallback(_DebugCallback callback);

}
// TODO: sharpobj store obj info
// TODO: api统一改成返回int, 代表不同的执行结果的返回码, 错误信息用err指针传出
// TODO: 画一张生命周期流程图
// TODO: api添加注释文档
